/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uk.ac.aber.compsci.se3920.groupA.Tests.Utils;

import uk.ac.aber.compsci.se3920.groupA.Tests.MockTypes.Equipment;
import uk.ac.aber.compsci.se3920.groupA.Tests.MockTypes.Meeting;
import uk.ac.aber.compsci.se3920.groupA.Tests.MockTypes.Room;
import uk.ac.aber.compsci.se3920.groupA.Tests.MockTypes.MeetingCandidate;
import uk.ac.aber.compsci.se3920.groupA.Tests.MockTypes.ExclusionRange;
import java.util.ArrayList;

/**
 *
 * @author rob
 */
public class Debug {
    
    //SET AT COMPILE TIME
    public static final int VERBOSITY = 1; //1 == print all messages
    
    public static void print(String message){
        System.err.println(message);
    }
 
    public static void print(int verbosity, String message){
        if(verbosity >= VERBOSITY){
            System.err.println(message);
        }
    }
    
    public static void printMC(ArrayList<MeetingCandidate> mc){
//        System.err.println("List Size : " + mc.size());
        for(MeetingCandidate m : mc){
            System.err.println("Candidate " + m.getStart().getTime() + " : " + m.getEnd().getTime() + "[" + m.isValidity() + "]" + "{" + m.getActiveScore() + "}");
        }
    }
    
    public static void printEX(ArrayList<ExclusionRange> ex){
//        System.err.println("List Size : " + ex.size());
        for(ExclusionRange m : ex){
            System.err.println("Exclusion " + m.getStart().getTime() + " : " + m.getEnd().getTime());
        }
    }
    
    public static void printMC_StartTimes(ArrayList<MeetingCandidate> mc){
//        System.err.println("List Size : " + mc.size());
        for(MeetingCandidate m : mc){
            System.err.println("Candidate " + m.getStart().getTime() + "{" + m.getActiveScore() + "}");
        }
    }
    
    public static void printMC_AllInfo(ArrayList<MeetingCandidate> mc){
//        System.err.println("List Size : " + mc.size());
        for(MeetingCandidate m : mc){
            System.err.println("Candidate " + m.getStart().getTime() + "{" + m.getActiveScore() + "}" + roomList(m.getPossibleRooms()));
        }
    }
    
    public static void printRoomList(ArrayList<Room> rooms){
        for(Room r : rooms){
            System.err.println("Room :" + r.getId() + " | " + r.getDept() + " | " + r.getCapacity() + " | " + equipmentList(r));
        }
    }
    
    public static String roomList(ArrayList<Room> rooms){
        String ret = new String();
        for(Room r : rooms){
            ret += "| " + r.getId() + "{" + r.getCapacity() + "}";
        }
        return ret;
    }
    
    public static void printMeeting(Meeting meeting){
        String ret = new String();
        for(int i=0;i<meeting.getMeetingEquipment().length;i++){
            ret += "[" + meeting.getMeetingEquipment()[i] + "]" ;
        }
        System.err.println("Duration: " + meeting.getMeetingDurationInHours() + "\nAttendance: " + meeting.getMeetingAttendance() + "\nEquipment: " + ret);
    }
    
    public static String equipmentList(Room room){
        String ret = new String();
        for(Equipment e : room.getEqList()){
            ret += "["+e.getType()+"] ";
        }
        return ret;
    }
}
